package com.sfy.designdemo.abstractfactory.factory;

import com.sfy.designdemo.abstractfactory.impl.Green;
import com.sfy.designdemo.abstractfactory.impl.Red;
import com.sfy.designdemo.abstractfactory.impl.Yellow;
import com.sfy.designdemo.abstractfactory.intf.Color;
import com.sfy.designdemo.abstractfactory.intf.Shape;

/**
 * Created by SiFeiYang on Date 2022/6/27
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public Color getColor(String color) {
        if (color == null) {
            return null;
        }
        if (color.equalsIgnoreCase("RED")) {
            return new Red();
        } else if (color.equalsIgnoreCase("GREEN")) {
            return new Green();
        } else if (color.equalsIgnoreCase("Yellow")) {
            return new Yellow();
        }
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        return null;
    }
}
